package com.example.demo;

import com.example.demo.entity.Demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by Choisaaaa on 2018/5/27.
 *@RestController == @Controller + @RequestMapping
 */

@RestController
public class HelloController {

    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public  String say(){
        return  "Hello Spring Boot";
    }

    @RequestMapping(value = "/getDemo",method = RequestMethod.GET)
    public Demo getDemo(){
        Demo demo = new Demo();
        demo.setId(1);
        demo.setName("Mark");
        demo.setCreateTime(new Date());
        demo.setRemark("这是备注信息");
        return demo;
    }
}
